package com.ruoyi.project.mobile.jiaqin;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.utils.R;
import com.ruoyi.project.jiaqin.companyrecruit.domain.CompanyRecruit;
import com.ruoyi.project.jiaqin.companyrecruit.service.ICompanyRecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/api/jq/recruit")
public class ApiRecruitController {

    @Autowired
    private ICompanyRecruitService iCompanyRecruitService;

    /**
     * 获取公司招聘信息列表
     * @param pageNum
     * @param pageSize
     * @param companyRecruit
     * @return
     */
    @GetMapping("/getCompanyRecruitList")
    public R getCompanyRecruitList(@RequestParam(value="pageNum",defaultValue="1",required = false) Integer pageNum
            ,@RequestParam(value="pageSize",defaultValue="5",required = false) Integer pageSize,CompanyRecruit companyRecruit){
        HashMap<String,Object> map = new HashMap<>();
        PageInfo<CompanyRecruit> pageInfo = iCompanyRecruitService.selectCompanyRecruitPage(pageNum,pageSize,companyRecruit);
        map.put("data",pageInfo);
        return R.ok(map);
    }

    /**
     * 根据招聘ID获取获取招聘信息
     * @param id
     * @return
     */
    @GetMapping("/getCompanyRecruitById")
    public R getCompanyRecruitById(String id){
        HashMap<String,Object> map = new HashMap<>();
        JSONObject jsonObject = iCompanyRecruitService.selectCompanyRecruitByIdA(id);
        map.put("data",jsonObject);
        return R.ok(map);
    }




}

